<?php e($javascript->codeBlock('$(document).ready(function(){$("#the-table").tableSorter();});'));?>
<div id="page-admin">
	
	<div class="action-buttons">
		<?php e($html->link('Add new page', '/admin/pages/add',array('class'=>'add')));?>
	</div>
	
	<table id="the-table">
		<caption>Pages on <?php e($sitename);?></caption>
		<colgroup>
			<col id="id" />
			<col id="title" />
			<col id="author" />
			<col id="published />"
			<col id="actions" />
		</colgroup>
		<thead>
			<tr>
				<th scope="col">Page ID</th>
				<th scope="col">Page Title</th>
				<th scope="col">Page Author</th>
				<th scope="col">Published?</th>
				<th scope="col">Actions</th>
			</tr>
		</thead>
		<tbody>
			<?php $row = 0; ?>
			<?php foreach ($pages as $page) : ?>
			<tr class="<?php ($row % 2 ? e('even') : e('odd'));?>">
				<td><?php e($page['Page']['id']);?></td>
				<td><?php e($html->link($page['Page']['title'], '/pages/view/' . $page['Page']['url']));?></td>
				<td><?php e($page['User']['username']);?></td>
				<td><?php ($page['Page']['published'] == 0 ? e('No') : e('Yes'));?></td>
				<td>
					<ul>
						<li><?php e($html->link('Edit', '/admin/pages/edit/' . $page['Page']['id'], array('class'=>'edit')));?></li>
						<li><?php e($html->link('Delete', '/admin/pages/delete/' . $page['Page']['id'], array('class'=>'delete'), 'Are you sure you want to delete '.$page['Page']['title']. '?'));?></li>
					</ul>
				</td>
			</tr>
			<?php $row++; ?>
			<?php endforeach; ?>
		</tbody>
	</table>
</div>